﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using Zhao.Arena.MiniProgram.Api.Utility.SwaggerExt;
using Zhao.Common.Helper;
using Zhao.IServer;
using Zhao.Models.DTO;
using Zhao.Service;

namespace Zhao.Arena.MiniProgram.Api.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class AreaServerController : ControllerBase
    {
        private readonly IAreaServer _areaServer;

        public AreaServerController(IAreaServer areaServer)
        {
            _areaServer = areaServer;
        }

        [HttpGet]
        public async Task<JsonResult> GetAreaPage()
        {
            return new JsonResult(new ApiResult<List<AreaDto>> { Data =  _areaServer.GetCity() ,Success=true});
        }

        /// <summary>
        /// 获取省市区
        /// </summary>
        /// <returns></returns>
        [HttpGet("llArea")]
        public async Task<JsonResult> GetAllAreaPage()
        {
            return new JsonResult(new ApiResult<List<AreaDto>> { Data =  _areaServer.GetAreas(), Success = true });
        }
    }
}
